﻿using System;
using System.Data;
using System.Web.Mvc;
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Drawing.Printing;
using System.Linq;
using BrnMall.Core;
using BrnMall.Manager.Domain.Store;
using BrnMall.Services;
using BrnMall.Web.Framework;

namespace BrnMall.Web.StoreAdmin.Models
{
    /// <summary>
    /// 店铺模型类
    /// </summary>
    public class StoreModel
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Required(ErrorMessage = "名称不能为空")]
        [StringLength(30, ErrorMessage = "名称长度不能大于30")]
        public string StoreName { get; set; }
        /// <summary>
        /// 区域id
        /// </summary>
        [Range(1, int.MaxValue, ErrorMessage = "请选择区域")]
        [DisplayName("区域")]
        public int RegionId { get; set; }
        /// <summary>
        /// 行业id
        /// </summary>
        [Range(1, int.MaxValue, ErrorMessage = "请选择行业")]
        [DisplayName("行业")]
        public int StoreIid { get; set; }
        /// <summary>
        /// logo
        /// </summary>
        [StringLength(50, ErrorMessage = "logo长度不能大于50")]
        public string Logo { get; set; }       
        /// <summary>
        /// 手机
        /// </summary>
        public string Mobile { get; set; }
        /// <summary>
        /// 固定电话
        /// </summary>
        [StringLength(13, ErrorMessage = "长度不能大于13")]
        public string Phone { get; set; }
        /// <summary>
        /// qq
        /// </summary>
        [StringLength(11, ErrorMessage = "qq长度不能大于11")]
        public string QQ { get; set; }
        /// <summary>
        /// 阿里旺旺
        /// </summary>
        [StringLength(50, ErrorMessage = "阿里旺旺长度不能大于50")]
        public string WW { get; set; }
        /// <summary>
        /// 主题
        /// </summary>
        public string Theme { get; set; }
        /// <summary>
        ///小程序二维码 
        /// </summary>
        [StringLength(500, ErrorMessage = "小程序二维码长度不能大于500")]
        public string WeApp_Qrcode { get; set; }
        /// <summary>
        ///订阅号二维码 
        /// </summary>
        [StringLength(500, ErrorMessage = "订阅号二维码长度不能大于500")]
        public string WeService_Qrcode { get; set; }
        /// <summary>
        ///小程序网站邮箱
        /// </summary>
       [StringLength(50, ErrorMessage = "店铺邮箱长度不能大于50")]
        public string Email { get; set; }
        /// <summary>
        ///店铺邮箱 
        /// </summary>
        public string WebSite { get; set; }
        /// <summary>
        /// Banner
        /// </summary>
        [StringLength(50, ErrorMessage = "banner长度不能大于50")]
        public string Banner { get; set; }
        /// <summary>
        /// 公告
        /// </summary>
        [StringLength(100, ErrorMessage = "公告长度不能大于100")]
        public string Announcement { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [AllowHtml]
        public string Description { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        [StringLength(200, ErrorMessage = "详细地址长度不能大于200")]
        public string Address { get; set; }
        /// <summary>
        /// 传真
        /// </summary>
        [StringLength(50, ErrorMessage = "传真长度不能大于50")]
        public string Fax { get; set; }
        /// <summary>
        /// 坐标
        /// </summary>
        [StringLength(100,ErrorMessage = "坐标长度不能大于100")]
        public string Location { get; set; }
        /// <summary>
        /// 视频地址
        /// </summary>
        [StringLength(2000,ErrorMessage = "视频地址长度不能大于2000")]
        public string VideoSrc { get; set; }

        public string SupportCompany { get; set; }
        public string SupportPhone { get; set; }
        /// <summary>
        /// 平台ID
        /// </summary>
        [Range(0,int.MaxValue,ErrorMessage ="必须是整数类型")]
        public int StorePid { get; set; }
    }

    /// <summary>
    /// 店铺分类列表模型类
    /// </summary>
    public class StoreClassListModel
    {
        /// <summary>
        /// 店铺分类列表
        /// </summary>
        public List<StoreClassInfo> StoreClassList { get; set; }
    }

    /// <summary>
    /// 店铺分类模型类
    /// </summary>
    public class StoreClassModel
    {
        /// <summary>
        /// 店铺分类名称
        /// </summary>
        [Required(ErrorMessage = "名称不能为空")]
        [StringLength(30, ErrorMessage = "名称长度不能大于30")]
        public string StoreClassName { get; set; }

        /// <summary>
        /// 父店铺分类id
        /// </summary>
        [Range(0, int.MaxValue, ErrorMessage = "请选择分类")]
        public int ParentId { get; set; }

        /// <summary>
        /// 店铺分类排序
        /// </summary>
        [Required(ErrorMessage = "排序不能为空")]
        [DisplayName("排序")]
        public int DisplayOrder { get; set; }
        
        public string Logo { get; set; }
        
    }

    /// <summary>
    /// 店铺配送模板列表模型类
    /// </summary>
    public class StoreShipTemplateListModel
    {
        /// <summary>
        /// 店铺配送模板列表
        /// </summary>
        public List<StoreShipTemplateInfo> StoreShipTemplateList { get; set; }
    }

    /// <summary>
    /// 添加店铺配送模板模型类
    /// </summary>
    public class AddStoreShipTemplateModel
    {
        /// <summary>
        /// 模板标题
        /// </summary>
        [Required(ErrorMessage = "模板标题不能为空")]
        [StringLength(50, ErrorMessage = "模板标题长度不能大于50")]
        public string TemplateTitle { get; set; }
        /// <summary>
        /// 是否免运费
        /// </summary>
        public int Free { get; set; }
        [Required(ErrorMessage = "商品金额不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "商品金额不能为负数")]
        public int FreeOrderAmount { get; set; }
        /// <summary>
        /// 计费类型(0代表按件数计算,1代表按重量计算)
        /// </summary>
        public int Type { get; set; }
        /// <summary>
        /// 起步值
        /// </summary>
        [Required(ErrorMessage = "起步值不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "起步值不能为负数")]
        [DisplayName("起步值")]
        public int StartValue { get; set; }
        /// <summary>
        /// 起步价
        /// </summary>
        [Required(ErrorMessage = "起步价不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "起步价不能为负数")]
        [DisplayName("起步价")]
        public int StartFee { get; set; }
        /// <summary>
        /// 加值
        /// </summary>
        [Required(ErrorMessage = "加值不能为空")]
        [Range(1, int.MaxValue, ErrorMessage = "加值必须大于0")]
        [DisplayName("加值")]
        public int AddValue { get; set; }
        /// <summary>
        /// 加价
        /// </summary>
        [Required(ErrorMessage = "加价不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "加价不能为负数")]
        [DisplayName("加价")]
        public int AddFee { get; set; }
    }

    /// <summary>
    /// 编辑店铺配送模板模型类
    /// </summary>
    public class EditStoreShipTemplateModel
    {
        /// <summary>
        /// 模板标题
        /// </summary>
        [Required(ErrorMessage = "模板标题不能为空")]
        [StringLength(50, ErrorMessage = "模板标题长度不能大于50")]
        public string TemplateTitle { get; set; }
        /// <summary>
        /// 是否免运费
        /// </summary>
        public int Free { get; set; }
        [Required(ErrorMessage = "商品金额不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "商品金额不能为负数")]
        public int FreeOrderAmount { get; set; }
        /// <summary>
        /// 计费类型(0代表按件数计算,1代表按重量计算)
        /// </summary>
        public int Type { get; set; }
    }

    /// <summary>
    /// 店铺配送费用列表模型类
    /// </summary>
    public class StoreShipFeeListModel
    {
        /// <summary>
        /// 店铺配送模板id
        /// </summary>
        public int StoreSTid { get; set; }
        /// <summary>
        /// 店铺配送费用列表
        /// </summary>
        public DataTable StoreShipFeeList { get; set; }
    }

    /// <summary>
    /// 店铺配送费用模型类
    /// </summary>
    public class StoreShipFeeModel
    {
        /// <summary>
        /// 区域
        /// </summary>
        [Required(ErrorMessage = "请选择区域")]
        [Range(-1, int.MaxValue, ErrorMessage = "请选择区域")]
        [DisplayName("区域")]
        public int RegionId { get; set; }
        /// <summary>
        /// 起步值
        /// </summary>
        [Required(ErrorMessage = "起步值不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "起步值不能为负数")]
        [DisplayName("起步值")]
        public int StartValue { get; set; }
        /// <summary>
        /// 起步价
        /// </summary>
        [Required(ErrorMessage = "起步价不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "起步价不能为负数")]
        [DisplayName("起步价")]
        public int StartFee { get; set; }
        /// <summary>
        /// 加值
        /// </summary>
        [Required(ErrorMessage = "加值不能为空")]
        [Range(1, int.MaxValue, ErrorMessage = "加值必须大于0")]
        [DisplayName("加值")]
        public int AddValue { get; set; }
        /// <summary>
        /// 加价
        /// </summary>
        [Required(ErrorMessage = "加价不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "加价不能为负数")]
        [DisplayName("加价")]
        public int AddFee { get; set; }
    }


    /// <summary>
    /// 店铺分类模型类
    /// </summary>
    public class StoreWxAppModel
    {

        [DisplayName("主键ID")]
        public int StoreWid { get; set; }

        /// <summary>
        /// 小程序ID
        /// </summary>
        public string WeAppId { get; set; }

        [DisplayName("小程序Secret")]
        public string WeAppSecret { get; set; }

        /// <summary>
        /// 商户ID
        /// </summary>
        [DisplayName("商户ID")]
        public int StoreId { get; set; }


        [DisplayName("微信支付商户ID")]
        public string MchId { get; set; }

   
        [DisplayName("微信支付商户KEY")]
        public string MchKey { get; set; }
        /// <summary>
        /// 发货成功模板消息ID
        /// </summary>
        [DisplayName("发货成功模板消息ID")]
        public string DeliverSuccessTid { get; set; }
        /// <summary>
        /// 预约成功模板消息ID
        /// </summary>
        [DisplayName("预约成功消息模板ID")]
        public string AppointMentSuccessTid { get; set; }
        /// <summary>
        /// 预约处理模板消息ID
        /// </summary>
        [DisplayName("预约处理消息模板ID")]
        public string AppointMentDisposeSuccessTid { get; set; }
        /// <summary>
        /// 预约处理模板消息ID
        /// </summary>
        [DisplayName("留言回复通知模板ID")]
        public string SendMsgCallbackTid { get; set; }
        /// <summary>
        /// 支付成功模板消息ID
        /// </summary>
        [DisplayName("支付成功模板消息ID")]
        public string PaySuccessTid { get; set; }
        [DisplayName("证书路径")]
        public string CertPath { get; set; }

        /// <summary>
        /// 是否默认
        /// </summary>
        public bool IsDefault { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Active { get; set; }
        /// <summary>
        /// 支付方式 0：微信，1;邮惠付
        /// </summary>
        [DisplayName("支付方式")]
        public int PayType { get; set; }
        /// <summary>
        /// 邮惠付商户ID
        /// </summary>
        public string PsbcMchId { get; set; }
        /// <summary>
        /// 邮惠付商户秘钥
        /// </summary>
        public string PsbcMchKey { get; set; }

    }

    public class StoreWxAppListModel
    {
        public IList<StoreWxApp> Result { get; set; }
    }



    public class BranchModel : BranchInfo
    {

        /// <summary>
        /// 店铺描述
        /// </summary>
        [AllowHtml]
        public override string Description { get; set; }
    }

    /// <summary>
    /// 店铺门店列表
    /// </summary>
    public class BranchListModel
    {
        public IList<BranchInfo> Result { get; set; }

        public PageModel PageModel { get; set; }
    }


}
